package com.niit.RPCCalculator;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.Server;

public class CalculatorStarter {
    public static void main(String[] args) {
        try {
            RPC.Builder builder = new RPC.Builder(new Configuration());

            builder.setBindAddress("node1").setPort(1000).setProtocol(CalculatorServiceInterface.class).setInstance(new CalculatorServiceImpl());

            Server server = builder.build();
            System.out.println(server.getListenerAddress().toString());
            System.out.println(server.getPort());
            System.out.println(server.getNumOpenConnections());
            server.start();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }
    }
}
